/*
 * @Author: luojianfeng
 * @Date: 2023-09-20 15:17:06
 * @LastEditTime: 2024-01-31 15:50:18
 * @LastEditors: luojianfeng
 * @Description:
 */
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import AutoImport from 'unplugin-auto-import/vite'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '~/': `${path.resolve(__dirname, 'src')}/`,
      '@/': `${path.resolve(__dirname, 'src')}/`
    }
  },
  plugins: [
    uni(),
    AutoImport({
      // Auto import functions from Vue, e.g. ref, reactive, toRef...
      // 自动导入 Vue 相关函数，如：ref, reactive, toRef 等
      imports: ['vue'],
      resolvers: [
        // Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
        // 自动导入 Element Plus 相关函数，如：ElMessage, ElMessageBox... (带样式)
        // ElementPlusResolver()
        // Auto import icon components
        // 自动导入图标组件
        // IconsResolver({
        //   prefix: 'Icon'
        // })
      ],
      eslintrc: {
        enabled: true // 生成自动按需导入导入eslint配置文件1、改为true用于生成eslint配置.
      }
      // dts: path.resolve(pathSrc, 'auto-imports.d.ts')//类型文件输出目录
    })
  ]
})
